/**
 * Copyright (C), 2019-2024,  XXX有限公司
 * FileName: WorkflowFileList
 * Author:   xs
 * Date:     2024/12/14 17:09
 * Description:
 * History:
 * <author>          <time>          <version>          <desc>
 * 作者姓名           修改时间           版本号              描述
 */

package com.koron.css2.newProjectCenter.impl.workflow;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.koron.css2.ServerInterface;
import com.koron.css2.newProjectCenter.bean.query.TbltaskAttachmentQueryBean;
import com.koron.css2.newProjectCenter.mapper.TbltaskAttachmentQueryMapper;
import com.koron.css2.newProjectCenter.vo.TbltaskAttachmentVo;
import com.koron.css2.serviceManage.bean.RequestBean;
import com.koron.css2.serviceManage.bean.UserInfoBean;
import com.koron.css2.serviceManage.utils.JsonUtils;
import com.koron.util.Constant;
import org.koron.ebs.mybatis.SessionFactory;
import org.swan.bean.MessageBean;

import java.util.List;

public class WorkflowFileList implements ServerInterface {

    @Override
    @SuppressWarnings("rawtypes")
    public MessageBean<?> exec(SessionFactory factory, UserInfoBean userInfo, RequestBean req) {
        try {
            //将入参转换为QueryBean
            TbltaskAttachmentQueryBean queryBean = JsonUtils.objectToPojo(req.getData(), TbltaskAttachmentQueryBean.class);
            //获取Mapper实例
            TbltaskAttachmentQueryMapper mapper = factory.getMapper(TbltaskAttachmentQueryMapper.class);


            //设置分页参数
            PageHelper.startPage(queryBean.getPage(), queryBean.getPageCount());
            //执行SQL
            List<TbltaskAttachmentVo> list = mapper.getList(queryBean);
			/*//获取来源渠道数据字典
			Map<String, String> PIS = Tools.mapDicByCode(factory, "PIS");
			//获取工程类型数据字典
			Map<String, String> PPT = Tools.mapDicByCode(factory, "PPT");
			 */
            //输出分页结果
            MessageBean<PageInfo> info = MessageBean.create(Constant.MESSAGE_INT_SUCCESS, "查询成功", PageInfo.class);
            info.setData(new PageInfo<>(list));
            return info;
        } catch (Exception e) {
            factory.close(false);
            logger.error("查询失败" + e.getMessage(), e);
            return MessageBean.create(Constant.MESSAGE_INT_FAIL, "查询失败", null);
        }
    }



}
